var mamObj=function(){
	this.x;
	this.y;
	this.angle;
	this.bigEye=new Image();
	this.bigBody=new Image();
	this.bigTail=new Image();

	this.mamEyeTimer=0;
	this.mamEyeCount=0;
	this.mamEyeInterval=1000;

	this.bigTailTimer=0;
	this.bigTailCount=0;


	this.mamBodyTimer=0;
	this.mamBodyCount=0;
	this.mamBodyInterval=1000;



}
mamObj.prototype.init=function()
{
	this.x=canWidth*0.5;
	this.y=canHeight*0.5;
	this.angle=0;




}
mamObj.prototype.draw=function()
{
	
	this.x=lerpDistance(mx,this.x,0.95);
	this.y=lerpDistance(my,this.y,0.95);

	var delteY=my-this.y;
	var delteX=mx-this.x;
	var beta=Math.atan2(delteY,delteX)+Math.PI;

	this.angle=lerpAngle(beta,this.angle,0.6);

	this.bigTailTimer+=deltaTime;
	if(this.bigTailTimer>50)
	{
		this.bigTailCount=(this.bigTailCount+1)%8;
		this.bigTailTimer%=50;
	}

	this.mamEyeTimer+=deltaTime;
	if(this.mamEyeTimer>this.mamEyeInterval)
	{
		this.mamEyeCount=(this.mamEyeCount+1)%2;
		this.mamEyeTimer%=this.mamEyeInterval;
		if(this.mamEyeCount==0)
		{
			this.mamEyeInterval=Math.random()*1500+2000;
		}
		else
		{
			this.mamEyeInterval=200;
		}

	}

	/*this.mamBodyTimer+=deltaTime;
	//console.log(deltaTime);
	if(this.mamBodyTimer>300)
	{
		this.mamBodyCount=this.mamBodyCount+1;
		this.mamBodyTimer=0;
		//console.log(this.babyBodyCount);
		if(this.mamBodyCount>=7)
		{
			this.mamBodyCount=7;
		}
		
	}*/


	ctx1.save();
	ctx1.translate(this.x,this.y);
	ctx1.rotate(this.angle);

	
	ctx1.drawImage(mamTails[this.bigTailCount],-mamTails[this.bigTailCount].width*0.5+30,-mamTails[this.bigTailCount].height*0.5);
	ctx1.drawImage(mamEye[this.mamEyeCount],-mamEye[this.mamEyeCount].width*0.5,-mamEye[this.mamEyeCount].height*0.5);
	
	if(data.double==1)
	{
		ctx1.drawImage(mamBody[this.mamBodyCount],-mamBody[this.mamBodyCount].width*0.5,-mamBody[this.mamBodyCount].height*0.5);
	}
	else
	{
		ctx1.drawImage(mamBlueBody[this.mamBodyCount],-mamBlueBody[this.mamBodyCount].width*0.5,-mamBlueBody[this.mamBodyCount].height*0.5);
	}

	ctx1.restore();

}
